/*
 * @Description  :
 * @Autor        : guoxi
 * @Date         : 2022-05-25 15:12:34
 * @LastEditors  : Please set LastEditors
 * @LastEditTime : 2022-09-27 11:44:04
 * @FilePath     : \rpms\src\api\project.ts
 */
import http from "../utils/http/service";
// ----------------------------项目管理相关--------------------------------------------

// 新增项目
export const postProjectAdd = (data): any => {
  return http.post("/rdms-admin/rdProject/add", data);
};

// 删除项目
export const postProjectDelete = (data): any => {
  return http.post("/rdms-admin/rdProject/delete", data);
};

// 查询项目列表
export const postProjectList = (data): any => {
  return http.post("/rdms-admin/rdProject/projectList", data);
};
// 查询项目列表
export const postProjectList2 = (data): any => {
  return http.post("/rdms-admin/rdProject/projectSelectList", data);
};

// 查询项目详情
export const getProjectInfo = (data): any => {
  return http.get(`/rdms-admin/rdProject/info/${data.id}`);
};

// 更新项目
export const postProjectUpdate = (data): any => {
  return http.post("/rdms-admin/rdProject/update", data);
};

// 变更项目
export const postProjectChange = (data): any => {
  return http.post("/rdms-admin/rdProject/alteration", data);
};
// 终止项目
export const postProjecStop = (data): any => {
  return http.post("/rdms-admin/rdProject/abort/apply", data);
};

// 【首页面板】模糊搜索相关项目列表
export const postProjectSearch = (data): any => {
  return http.post("/rdms-admin/rdProject/proLikeList", data);
};

// 【首页面板】-项目数量统计、其他信息统计、项目类型统计
export const postProjectDataInfo = (data): any => {
  return http.post("/rdms-admin/rdProject/home/proTotal", data);
};

// 【首页面板】-科研成果情况、各单位项目科研成果、各单位各类型科研成果
export const postProjectDataKyInfo = (data): any => {
  return http.post("/rdms-admin/rdProject/home/sciStatistics", data);
};

// 【首页面板】-项目列表
export const postProjectByYear = (data): any => {
  return http.post("/rdms-admin/rdProject/home/proList", data);
};
// 【首页面板】-项目详情、科研成果
export const postProjectInfo = (data): any => {
  return http.post("/rdms-admin/rdProject/home/proInfoKy", data);
};

// 【首页】科研经费汇总（饼图
export const postProjectHomePie = (data): any => {
  return http.post(`/rdms-admin/fee/summary/statistics/homePie/${data}`);
};
// 【首页】各部门年度预算完成金额和比例~柱状图折线图
export const postProjectHomeHis = (data): any => {
  return http.post(`/rdms-admin/fee/summary/statistics/homeHis/${data}`);
};

export const postProjectDataLibs = (data): any => {
  return http.post("/rdms-admin/datalib/list", data);
};

export const updateProjectNumber = (projectId, projectNum): any => {
  return http.post(
    `/rdms-admin/rdProject/supplement/${projectId}/${projectNum}`
  );
};
export const approveProject = (projectId): any => {
  return http.post(`/rdms-admin/rdProject/approve/${projectId}`);
};
export const recallProject = (projectId): any => {
  return http.post(`/rdms-admin/rdProject/recall/${projectId}`);
};
export const rejectProject = (data): any => {
  return http.post(`/rdms-admin/rdProject/reject`, data);
};

export const updateProgress = (data): any => {
  return http.post(`/rdms-admin/rdProject/progress/update`, data);
};

//立项
export const getApproveList = (data): any => {
  return http.post(`/rdms-admin/project/stage/approve/list`, data);
};
export const updateApprove = (data): any => {
  return http.post(`/rdms-admin/project/stage/approve/update`, data);
};
//更新部分项目信息
export const updateProjectBase = (data): any => {
  return http.post(`/rdms-admin/rdProject/update/base`, data);
};
export const getApproveById = (id): any => {
  return http.post("/rdms-admin/project/stage/approve/detail/" + id);
};

//流程发起
export const flowStart = (data): any => {
  return http.post(`/rdms-admin/rdProject/flow/flowStart`, data);
};

//流程审批
export const flowSubmit = (data): any => {
  return http.post(`/rdms-admin/rdProject/flow/flowSubmit`, data);
};

//流程驳回
export const flowReject = (data): any => {
  return http.post(`/rdms-admin/rdProject/flow/flowReject`, data);
};

//获取流程审批历史
export const getApproveHistory = (instanceId): any => {
  return http.post(`/rdms-admin/flow/common/approveHistory/${instanceId}`);
};

//获取某一节点的审批人
export const getApproveHandlerId = (instanceId, nodeId): any => {
  return http.post(
    `/rdms-admin/flow/common/approveHistory/${instanceId}/${nodeId}`
  );
};

//实施
export const getPlanById = (id): any => {
  return http.post("/rdms-admin/rdProject/plan/detail/" + id);
};

export const updatePlan = (data): any => {
  return http.post(`/rdms-admin/rdProject/update/plan`, data);
};

//验收

export const getAacceptanceList = (data): any => {
  return http.post(`/rdms-admin/project/stage/acceptance/list`, data);
};
export const updateAacceptance = (data): any => {
  return http.post(`/rdms-admin/project/stage/acceptance/update`, data);
};
export const getAacceptanceById = (id): any => {
  return http.post("/rdms-admin/project/stage/acceptance/detail/" + id);
};
//评价

export const getEvaluationList = (data): any => {
  return http.post(`/rdms-admin/project/stage/evaluation/list`, data);
};
export const updateEvaluation = (data): any => {
  return http.post(`/rdms-admin/project/stage/evaluation/update`, data);
};
export const getEvaluationById = (id): any => {
  return http.post("/rdms-admin/project/stage/evaluation/detail/" + id);
};

export const submitStage = (id): any => {
  return http.post("/rdms-admin/rdProject/stage/process/submit/" + id);
};

export const approveStage = (id): any => {
  return http.post("/rdms-admin/rdProject/approve/stage/" + id);
};
export const rejectStage = (data): any => {
  return http.post("/rdms-admin/rdProject/approve/stage/reject", data);
};

export const getHomeFeeTotal = (data): any => {
  return http.post(`/rdms-admin/home/fee/total/${data.year}`, data);
};

export const getHomeSpendType = (data): any => {
  return http.post(`/rdms-admin/home/fee/spend/type/pie/${data.year}`, data);
};

export const getHomeStatictis = (data): any => {
  return http.post(
    `/rdms-admin/home/fee/statictis/dept/histogram/${data.year}`,
    data
  );
};

export const getHomeProjectTotal = (data): any => {
  return http.post(`/rdms-admin/home/fee/project/total/${data.id}`, data);
};

export const getHomeProjectHistogram = (data): any => {
  return http.post(`/rdms-admin/home/project/fee/histogram/${data.id}`, data);
};

export const getHomeProjectScientific = (data): any => {
  return http.post(`/rdms-admin/home/project/scientific/${data.id}`, data);
};

//可行性研究
export const getFsbStudyList = (data): any => {
  return http.post(`/rdms-admin/fsbStudy/list`, data);
};
//可行性研究详情
export const getFsbStudyDetail = (data): any => {
  return http.get(`/rdms-admin/fsbStudy/info/${data.id}`);
};

//更新可行性研究
export const updateFsbStudy = (data): any => {
  return http.post(`/rdms-admin/fsbStudy/update`, data);
};
//提交可行性研究
export const submitFsbStudy = (data): any => {
  return http.post(`/rdms-admin/rdProject/flow/flowStart`, data);
};

//专家评审列表
export const getExpertList = (data): any => {
  return http.post(`/rdms-admin/expertRvw/list `, data);
};

//新增专家评审
export const addExpert = (data): any => {
  return http.post(`/rdms-admin/expertRvw/add`, data);
};
//保存专家评审
export const saveExpert = (data): any => {
  return http.post(`/rdms-admin/expertRvw/update`, data);
};

//专家评审详情
export const getExpertDetail = (data): any => {
  return http.get(`/rdms-admin/expertRvw/info/${data.id}`);
};

//保存专家评审汇总
export const saveRvwSummary = (data): any => {
  return http.post(`/rdms-admin/expertRvw/rvwSummary`, data);
};

//获取专家评审意见列表
export const getExpertRvwOpinion = (data): any => {
  return http.post(`/rdms-admin/expertRvw/opinion/list`, data);
};

//专家评审意见详情
export const getExpertRvwOpinionDetail = (data): any => {
  return http.get(`/rdms-admin/expertRvw/opinion/info/${data.id}`);
};

//更新专家评审意见
export const updateExpertRvwOpinion = (data): any => {
  return http.post(`/rdms-admin/expertRvw/opinion/update`, data);
};

//获取taskId
export const getTaskId = (data): any => {
  return http.post(`/rdms-admin/flow/common/getTaskId`, data);
};

//项目工时

// 工时列表查询
export const workingHourList = (data): any => {
  return http.post(`/rdms-admin/workingHour/list`, data);
};

// 查询项目成员
export const memberList = (data): any => {
  return http.post(`/rdms-admin/bizUser/list`, data);
};

//保存工时
export const saveWorkingHour = (data): any => {
  return http.post(`/rdms-admin/workingHour/save`, data);
};

// 工时详情
export const workingHourDetails = (data): any => {
  return http.post(`/rdms-admin/workingHour/details`, data);
};

//删除工时
export const workingHourDelete = (data): any => {
  return http.post("/rdms-admin/workingHour/delete", data);
};

//获取流程审批图片
export const getApproveImg = (instanceId): any => {
  return http.get(
    `/rdms-admin/rdProject/flow/img/showImg?instanceId=${instanceId}`
  );
};

//获取专家是否同意承诺书
export const getAgree = (data): any => {
  return http.post(
    `/rdms-admin/expertStaff/agree`, data
  );
};